# for i in range(0,5):
#     print("AAAA")
#     for j in range(0,3):
#         print("BBB")
#         if j==1:
#             # break只是跳出当前内循环
#             break

total=int(input())
arr=list(map(int,input().split()))
n=int(input())
def getResult():
    arr.sort()
    ans=0
    for i in range(0,total):
        for j in range(total-1,i,-1):
            sumV=arr[i]+arr[j]
            if sumV==n:
                ans=ans+1
            elif sumV<n:
                break
    return ans
print(getResult())
# 5
# 1 2 2 2 3
# 4


